package exio;

import java.io.File;

/**
 * @author: knowno
 * @create: 2025-09-16 15:21
 * @Version 1.0
 **/
public class TestFile2 {
    public static void main(String[] args) {

        String path ="G:\\02-诚毅软工22-后端\\2-授课期\\2025-09-chengyi";

        File file = new File(path);
        //先判断是否是目录
        if (file.isDirectory()){
            //是目录
            //获取目录下的所有文件 =>String []
            String[] list = file.list();
            for (String s : list) {
                System.out.println(s);
            }
            System.out.println("***********************************");
            //获取目录下的所有文件 =>File []
            File[] files = file.listFiles();
            for (File f : files) {
                System.out.println(f.getName());
            }
        }


    }
}
